#include "mainwindow.h"
#include "ui_mainwindow.h"

#include <QDialog>

MainWindow::MainWindow(QWidget *parent): QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    connect(ui->actionNew, &QAction::triggered, this, &MainWindow::showDialog1);
}

MainWindow::~MainWindow()
{
    delete ui;
}

/**
 * 显示模态弹窗
 */
void MainWindow::showDialog1()
{
    // QDialog dialog(this);
    // dialog.resize(300,200);
    // dialog.exec();

    // 非模态对话框
    QDialog* dialog = new QDialog(this);
    dialog->resize(200,200);
    dialog->setAttribute(Qt::WA_DeleteOnClose);
    dialog->show();
}
